package com.hsgene.common;

import com.hsgene.common.util.exception.IllegalParamException;

/**
 * @description:
 * @projectName: hdas-geneshop-server
 * @package: com.hsgene.common
 * @author: maodi
 * @createDate: 2019/1/31 14:24
 * @version: 1.0
 * Copyright: Copyright (c) 2019
 */
public enum CaseType {

    /**
     * 常规案例
     */
    CONVENTIONAL_CASES(0, "常规案例"),

    /**
     * 急需案例
     */
    URGENT_CASE(1, "急需案例"),

    /**
     * 普通病历
     */
    GENERAL_MEDICAL_RECORD(2, "普通病历"),

    /**
     * 基因检测报告病历
     */
    GENE_DETECTION_REPORT(3, "基因检测报告病历");

    private Integer code;

    private final String identifier;

    CaseType(Integer code, String identifier) {
        this.code = code;
        this.identifier = identifier;
    }

    public static CaseType getEnum(Integer code) {
        for (CaseType type : values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        throw new IllegalParamException("非法的病历类型类型参数：" + code);
    }

    public String getIdentifier() {
        return identifier;
    }

    public Integer getCode() {
        return code;
    }
}
